﻿@using CMSMVC4.Filters
@using CMSMVC4.MultiResource
@model List<CMSMVC4.Areas.Admin.Models.CommentComfirmModel>

@{
    ViewBag.Title = @Admin.Comment;
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
<script language="javascript" type="text/javascript">
    function dellall() {
        var chek = $('#checkall').is(':checked');
        if (chek == true) {
            $(".checker span").attr('class', "checked");
            $(".dell").attr('checked', true);
        } else {
            $(".checker span").attr('class', "");
            $(".dell").attr('checked', false);

        }
    }
    function senddell() {
        var id = [];
        $(".dell:checked").each(function () {
            var v = $(this).attr("index");
            id.push(v);
        });
        if (id.length>0) {
            var cf = confirm("Bạn có chắc chắn muốn xóa không?");
            if (cf == true) {
                $.ajax({
                    type: "Post",
                    dataType: "json",
                    contentType: 'application/json; charset=utf-8',
                    url: "/Admin/Comment/Delete",
                    data: JSON.stringify(id),
                    success: function () {
                        window.location = "/Admin/Comment/NotConfirm";
                    }
                });
            }
        } else {
            alert("Hãy chọn bưu gửi muốn xóa!");
        }
    }
</script>
@using (Html.BeginForm("Confirm", "Comment", FormMethod.Post))
{
    <div class="row-fluid">
        <div class="box color_8">
            <div class="title">
                <h4><span>@Admin.ListContact <small></small></span></h4>
            </div>
            <div class="content top">
                <table id="datatable_example" class="responsive table table-striped table-bordered" style="width: 100%">
                    <thead>
                        <tr>
                            <th class="jv no_sort">
                                <label class="checkbox ">
                                    <input type="checkbox" id="checkall" onchange="dellall()"/>
                                </label>
                            </th>
                            <th class="">@Admin.Email</th>
                            <th class="to_hide_phone">@Admin.Content</th>
                            <th class="">@Admin.Actions</th>
                            <th style="display: none"></th>
                        </tr>
                    </thead>
                    <tbody>
                        @for (int i = 0; i < Model.Count; i++)
                        {
                            <tr>
                                <td>
                                    @Html.CheckBoxFor(x => x[i].status ,new{@class="dell",index =Model[i].id})
                                </td>
                                <td class="">@Model[i].email</td>
                                <td class="to_hide_phone">@Model[i].data</td>
                                <td class="ms">
                                    <div class=" btn-group">
                                        <a class="btn btn-small" onclick="senddell()">
                                            <i class="gicon-remove"></i>
                                        </a>
                                    </div>
                                </td>
                                <td style="display: none">@Html.HiddenFor(x => x[i].id)</td>
                            </tr>
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <input class="btn btn-success btn-large" type="submit" value="@Admin.Approve" />
}
